home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 19 / 019.d81 / t.pps #42 < prev    next >
Text File  |  2022-08-26  |  4KB  |  215 lines

  1.  
  2. ======================================
  3.   PEEKs, POKEs, and SYSes, Part 42
  4.  
  5.            by Jim Weiler
  6. ======================================
  7.  
  8.   Welcome back to our exposition of
  9.  
  10. C-64 sound.  Last month we learned
  11.  
  12. all about envelopes.  Can you say
  13.  
  14. "ADSR"?  Good!  This time we delve
  15.  
  16. into the mysteries of voice,
  17.  
  18. waveform, and volume.
  19.  
  20.             ----------
  21.    The Three Voices of Every C-64
  22.             ----------
  23.  
  24.   When we say a person has three
  25.  
  26. voices, we mean he can talk three
  27.  
  28. different ways.  When we say the C-64
  29.  
  30. has three voices, we mean it can make
  31.  
  32. three different sounds at the same
  33.  
  34. time.  Each voice can have a
  35.  
  36. different pitch, waveform, and adsr.
  37.  
  38. All three must use the same volume.
  39.  
  40.   The first 21 of SID's registers are
  41.  
  42. used to control the individual
  43.  
  44. voices.  That works out nicely to
  45.  
  46. seven registers per voice.  The first
  47.  
  48. group of seven (SID+0 to SID+6) is
  49.  
  50. for voice one, the second group for
  51.  
  52. voice two, and the third group for
  53.  
  54. voice three.
  55.  
  56. A Detailed Description of the
  57. Functions of Voice Control Registers:
  58. ------------------------------------
  59. S+0 = Pitch - low byte
  60. S+1 = Pitch - high byte
  61. S+2 = Pulse rate - low byte
  62. S+3 = Pulse rate - high byte
  63. S+4 = Waveform
  64. S+5 = Attack/Decay
  65. S+6 = Sustain/Release
  66.  
  67. Voices two and three are the same,
  68.  
  69. except that you add 7 to the offset
  70.  
  71. for voice two and 14 for voice three.
  72.  
  73.   For now, don't worry about pitch.
  74.  
  75. We'll get into pitch next time.  It's
  76.  
  77. not difficult, but it is complicated
  78.  
  79. enough to deserve in-depth coverage.
  80.  
  81.   You already understand ADSR, so I
  82.  
  83. guess you need to know about
  84.  
  85. waveform and pulse rate.
  86.  
  87.   Waveform describes the shape of the
  88.  
  89. sound waves SID generates.  Don't
  90.  
  91. confuse it with ADSR which discribes
  92.  
  93. the shape of the volume envelope.
  94.  
  95. The volume envelope is really nothing
  96.  
  97. more than the outline of the
  98.  
  99. amplitude of the sound waves.  Sure,
  100.  
  101. I know that sounds obscure.  Just
  102.  
  103. think of ADSR as amplitude
  104.  
  105. modulation, and waveform as the
  106.  
  107. carrier wave.
  108.  
  109.   There are four waveforms built into
  110.  
  111. SID: triangle, sawtooth, pulse, and
  112.  
  113. noise.  Rather than try to describe
  114.  
  115. each, I'll give you pictures:
  116.  
  117. TRIANGLE:string of isosceles triangles
  118.  
  119.         .     .     .     .
  120.        . .   . .   . .   .
  121.       .   . .   . .   . .
  122.      .     .     .     .
  123.  
  124.  
  125. SAWTOOTH:like the blade of a saw
  126.  
  127.      .   .   .   .   .
  128.      ..  ..  ..  ..  ..
  129.      . . . . . . . . . .
  130.      .  ..  ..  ..  ..  .
  131.      .   .   .   .   .   .
  132.  
  133. PULSE:alternates between on and off
  134.  
  135.      .....   .....   .....
  136.      .on .   .on .   .on .
  137.      .   .   .   .   .   .
  138.      .   .off.   .off.   .
  139.      .   .....   .....   .
  140.  
  141. NOISE:random - like the wind
  142.  
  143.         .    .     ..
  144.        ..  .. .    . . .
  145.        ..  .  .    . ... .
  146.       . ...   . . .    ..
  147.      .        .. .     .
  148.  
  149.  
  150.   It's not particularly important
  151.  
  152. that you know what the different
  153.  
  154. waveforms look like.  What counts is
  155.  
  156. what they sound like.  The triangle
  157.  
  158. wave sounds smooth, like a flute.
  159.  
  160. The sawtooth is coarser.  The noise
  161.  
  162. waveform sounds just like wind.  And
  163.  
  164. the pulse waveform sounds like a lot
  165.  
  166. of things, depending on its pulse
  167.  
  168. rate.  (Pulse rate is the
  169.  
  170. relationship of on time and off
  171.  
  172. time.  Triangle, sawtooth, and noise
  173.  
  174. waveforms don't have pulse rates,
  175.  
  176. because they don't take time off.)
  177.  
  178. A pulse waveform that is mostly "on"
  179.  
  180. or mostly "off" will produce a
  181.  
  182. thready sound.  One that is closer to
  183.  
  184. half on/half off will be more
  185.  
  186. full-bodied.
  187.  
  188.   "But what about volume?" I can hear
  189.  
  190. you asking.  Volume is simple.  Poke
  191.  
  192. a value from 0 to 15 into register
  193.  
  194. S+24.  0 is turned off.  15 is full
  195.  
  196. volume.  All three voices use the
  197.  
  198. same volume, so you can't make one
  199.  
  200. loud and another quiet by setting
  201.  
  202. volume.  To achieve that effect, you
  203.  
  204. need to use waveform and ADSR.
  205.  
  206.   Enough delving, already!  Let's
  207.  
  208. take a look at the nitty-gritty
  209.  
  210. details of POKEing waveform, pulse
  211.  
  212. rate, and volume.
  213.  
  214. -----<continued in next article>-----
  215.